package com.boc.langxiang.ui.adapter.index;

import android.content.Context;
import android.widget.ImageView;

import com.boc.langxiang.R;
import com.boc.langxiang.entity.response.ArticleEntity;
import com.boc.langxiang.manager.PicassoImageLoader;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * CreateTime: 2016-06-17上午9:23
 * Author: wjkjinke00@126.com
 * Description:
 */
public class IndexAdapter extends BaseQuickAdapter<ArticleEntity> {

    public IndexAdapter(Context context, List<ArticleEntity> data) {
        super(R.layout.item_index_article, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ArticleEntity item) {
        helper.setText(R.id.title, item.getTitle())
                .setText(R.id.count, item.getClick())
                .setText(R.id.name, item.getAuthor());

        PicassoImageLoader.getInstance().displayUrlImage(mContext, item.getPhotourl()
                , (ImageView) helper.getView(R.id.image));
        PicassoImageLoader.getInstance().displayUrlImage(mContext, item.getHeadphotourl()
                , (ImageView) helper.getView(R.id.head));
    }

}
